package com.rpj.stauy.config;

import cn.hutool.core.util.IdUtil;
import com.rpj.stauy.controller.AiController;
import dev.langchain4j.model.chat.listener.ChatModelErrorContext;
import dev.langchain4j.model.chat.listener.ChatModelListener;
import dev.langchain4j.model.chat.listener.ChatModelRequestContext;
import dev.langchain4j.model.chat.listener.ChatModelResponseContext;

import java.lang.annotation.Annotation;
import java.util.Arrays;

public class MyChatModelistener implements ChatModelListener {

    //
    @Override
    public void onError(ChatModelErrorContext errorContext) {

        System.out.println("onError errorContext这是什么：" +errorContext);
    }

    @Override
    public void onRequest(ChatModelRequestContext requestContext) {
        String string = IdUtil.simpleUUID();
        requestContext.attributes().put("my" ,string);
        System.out.println("onRequest requestContext这是什么：" +requestContext);
    }

    @Override
    public void onResponse(ChatModelResponseContext responseContext) {
        Object o = responseContext.attributes().get("my");
        System.out.println("onResponse responseContext这是什么：" +responseContext+"  " + o);
    }
}
